<template>
  <ul class="nav-links">
    <li v-for="(link, index) in links" :key="index">
      <router-link :to="link.path">{{ link.text }}</router-link>
    </li>
  </ul>
</template>

<script>
import { useRouter } from "vue-router";

export default {
  name: "NavLinks",
  props: {
    links: {
      type: Array,
      default: () => [
        { text: "首页", path: "/" },
        { text: "地方文化", path: "/history" },
        { text: "景点预约", path: "/site" },
        { text: "美食", path: "/food" },
        { text: "留言板", path: "/message" },
      ],
    },
  },
  setup() {
    const router = useRouter();

    return {
      router,
    };
  },
};
</script>

<style scoped>
.nav-links {
  display: flex;
  list-style: none;
  justify-content: center;
  width: 100%;
}

.nav-links li {
  margin: 0 15px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--accent-color);
}

@media (max-width: 768px) {
  .nav-links {
    margin-top: 15px;
  }

  .nav-links li {
    margin: 0 10px;
  }
}
</style>
